<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>其他收支列表</title>
	<include file="Public:header" />
	<style type="text/css">
		.input{width:150px;border:1px solid #ccc;padding:2px;}
	</style>
	<script type="text/javascript">
		var actflg="{:C('URL_MODEL')}"=="0"?"&":"?";
		function data_status_to_a()
		{
			var selChk="";
			//遍历得到每个checkbox的value值
			$("input[name='chk_list']").each(function(){
				if(this.checked){selChk+=this.value+",";}				
			});
			selChk+="0";
			if(selChk=="0")
			{
				$.messager.show({title:'提示',msg:'没有选中要启用的项',timeout:5000,showType:'slide'});
			}
			else
			{
				$.messager.confirm('询问', '确认要启用选中的项吗？', function(r){
					if (r){
						//todo...
						window.location.href="{:U('Faotherio/data_status_to_a')}"+actflg+"id="+selChk+"";
					}
				});
			}
		}
		
		function data_status_to_c()
		{
			var selChk="";
			//遍历得到每个checkbox的value值
			$("input[name='chk_list']").each(function(){
				if(this.checked){selChk+=this.value+",";}				
			});
			selChk+="0";
			if(selChk=="0")
			{
				$.messager.show({title:'提示',msg:'没有选中要取消的项',timeout:5000,showType:'slide'});
			}
			else
			{
				$.messager.confirm('询问', '确认要取消选中的项吗？', function(r){
					if (r){
						//todo...
						window.location.href="{:U('Faotherio/data_status_to_c')}"+actflg+"id="+selChk+"";
					}
				});
			}
		}
		
		function data_status_to_n()
		{
			var selChk="";
			//遍历得到每个checkbox的value值
			$("input[name='chk_list']").each(function(){
				if(this.checked){selChk+=this.value+",";}				
			});
			selChk+="0";
			if(selChk=="0")
			{
				$.messager.show({title:'提示',msg:'没有选中要存档的项',timeout:5000,showType:'slide'});
			}
			else
			{
				$.messager.confirm('询问', '确认要存档选中的项吗？', function(r){
					if (r){
						//todo...
						window.location.href="{:U('Faotherio/data_status_to_n')}"+actflg+"id="+selChk+"";
					}
				});
			}
		}
		
		function selectall_todo()
		{
			$("input[name='chk_list']").attr("checked",true);
		}
		function selectall_undo()
		{
			$("input[name='chk_list']").attr("checked",false);
		}
		$(document).ready(function(){
			$('#misone_list_table').datagrid({
				//url: '///',
				//title: 'DataGrid',
				//width: 800,
				//height: 220,
				fitColumns: true,
				nowrap:false,
				rownumbers:true,
				showFooter:false,
				columns:[[
					{field:'itemselect',title:'选择',width:20},
					{field:'itemid',title:'ID',width:40},					
					{field:'fadate',title:'日期',width:80},
					{field:'mas_code',title:'类型',width:80},
					{field:'amount',title:'金额',width:80},
					{field:'comment',title:'说明',width:150},
					{field:'remark',title:'备注',width:100},
					{field:'status_flg',title:'状态',width:40,align:'center'},
					{field:'view_edit',title:'操作',width:60,align:'center'}
				]]
			});
		});
		
		function data_post(dataId)
		{
			var url = $(this).attr('data-url');
			$.messager.confirm('询问', '确认要过账吗？', function(r){
				if (r){
					//todo...
					window.location.href="{:U('Faotherio/data_post')}"+actflg+"id="+dataId+"";
				}
			});
		}
	</script>
</head>
<body class="">
	<div class="demo-info space-out-5px">
		<div class="demo-tip icon-tip"></div>
		<div>其他收支列表</div>
		<div>
		<form id="frm_search" method="post" action="{:U('Faotherio/data_list')}" style="margin:10px auto 0px 25px;">
		<div style="float:left; margin:0px; padding:2px;">
		<select id="s_mas_code" name="mas_code" class="easyui-combobox" editable="false" style="width:100px;">
								<option value=''>所有类型</option>								
								<option value='INCOME'>其他收入</option>
								<option value='PAYOUT'>其他支出</option>
								
		</select>		
		</div>
		<script type="text/javascript">$("#s_mas_code").attr("value","{$mas_code}");</script>
		
		<div style="float:left; margin:0px; padding:2px;">
		<select id="s_status_flg" name="status_flg" class="easyui-combobox" editable="false" style="width:100px;">
								<option value=''>所有状态</option>								
								<volist id="status_list" name="status_list">
								<option value='{$status_list.code}'>{$status_list.code|get_status_title=###,false}</option>
								</volist>
		</select>		
		</div>
		<script type="text/javascript">$("#s_status_flg").attr("value","{$status_flg}");</script>
		日期从：<input type="text" id="fadate1" name="fadate1" class="easyui-datebox" editable="false" style="width:100px;" value="{$fadate1}" />
		日期到：<input type="text" id="fadate2" name="fadate2" class="easyui-datebox" editable="false" style="width:100px;" value="{$fadate2}" />
		<input type="text" id="keywords" name="keywords" class="input" value="{$keywords}" />
		<a href="javascript:;" class="easyui-linkbutton" iconCls="icon-search" onclick="$('#frm_search').submit();">搜索</a>
		<a href="{:U('Faotherio/data_list')}" class="easyui-linkbutton" iconCls="icon-reload">显示所有</a>
		<a href="{:U('Faotherio/data_add?mas_code=INCOME')}" class="easyui-linkbutton" iconCls="icon-add">新增收入</a>
		<a href="{:U('Faotherio/data_add?mas_code=PAYOUT')}" class="easyui-linkbutton" iconCls="icon-add">新增开支</a>
		</form>
		</div>
	</div>
	<div class="list-box space-out-5px">
	<php>$page_total=0;</php>
	<table id="misone_list_table"><tbody>
	<volist name="datalist" id="datalist">
	<tr>
		<td field="itemselect"><if condition="($datalist['status_flg'] NEQ 'P')">
		<input type="checkbox" name="chk_list" value="{$datalist.id}" style="margin-top:6px;" />
		</if></td>
		<td field="itemid">{$datalist.id}</td>		
		<td field="fadate">{$datalist.fadate|date='Y-m-d',###}</td>
		<td field="mas_code">{$bank_list[$datalist['bank']]}-{$datalist.mas_code}-<if condition="($datalist['mas_code'] EQ 'INCOME')">收入<else/>支出</if></td>
		<td field="amount">{$datalist.amount}</td>
		<td field="comment">{$datalist.comment}</td>
		<td field="remark">{$datalist.remark}</td>
		<td field="status_flg">{$datalist.status_flg|get_status_title=###,true}</td>
		<td field="view_edit"><if condition="$datalist['status_flg'] eq 'A'">
		<a href="{:U('Faotherio/data_edit?id='.$datalist['id'].'')}">编辑</a> - <a onclick="data_post('{$datalist.id}')" href="javascript:;" data-url="{:U('Faotherio/data_post?id='.$datalist['id'].'')}">过账</a>
		<else />
		<a href="{:U('Faotherio/data_edit?id='.$datalist['id'].'')}">查看</a>
		</if>
		<if condition="$datalist['status_flg'] eq 'P'">
		 - <a href="javascript:;" onclick="javascript:parent.addTab('追踪总账凭证({$datalist.mas_code}#{$datalist.id})','{:U('Finance/vou_track?refcode='.$datalist['mas_code'].'&refid='.$datalist['id'].'')}');">总账凭证</a>
		</if>
        </td>
	</tr>
	<php>$page_total+=(double)$datalist['amount'];</php>
	</volist>
	
	<tr>
		<td field="itemselect">&nbsp;</td>
		<td field="itemid">&nbsp;</td>		
		<td field="fadate">&nbsp;</td>
		<td field="mas_code"><i>本页小计</i></td>
		<td field="amount"><i>{$page_total}</i></td>
		<td field="comment">&nbsp;</td>
		<td field="remark">&nbsp;</td>
		<td field="status_flg">&nbsp;</td>
		<td field="view_edit">&nbsp;</td>
	</tr>
	
	</tbody></table>
	
	<div style="height:5px; clear:both;"></div>
	
	</div>
	
	
	<div class="space-out-5px">	
	
	<div class="list-title">
		<div class="list-t-l">操作：<a href="javascript:;" onclick="selectall_todo()">全选</a> - <a href="javascript:;" onclick="selectall_undo()">取消选择</a>
		- <a href="javascript:;" onclick="data_status_to_n()">存档</a>
		- <a href="javascript:;" onclick="data_status_to_a()">启用</a>
		- <a href="javascript:;" onclick="data_status_to_c()">取消</a>
		</div>
		<div class="list-t-r">
		<a href="{:U('Faotherio/data_add?mas_code=INCOME')}" class="easyui-linkbutton" iconCls="icon-add">新增收入</a>
		<a href="{:U('Faotherio/data_add?mas_code=PAYOUT')}" class="easyui-linkbutton" iconCls="icon-add">新增开支</a>
		</div>
	</div>
	
	
	</div>
	
	<div class="demo-info space-out-5px">
		<div class="demo-tip icon-tip"></div>
		<div class="pages">&nbsp;{$page}</div>
	</div>
</body>
</html>
